<template>
  <a-form-model
    :ref="'complication' + confirmType"
    :model="complication"
    :label-col="formItemLayout.labelCol"
    :wrapper-col="formItemLayout.wrapperCol"
    labelAlign="left"
  >
    <a-form-model-item label="确诊情况">
      <a-radio-group v-model="complication.extremity">
        <a-radio :value="1"> 确诊有 </a-radio>
        <a-radio :value="2"> 确诊无 </a-radio>
        <a-radio :value="3"> 未确诊 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <div class="content" v-show="complication.extremity === 1">
      <a-divider />
      <a-form-model-item label="确诊日期">
        <a-date-picker
          :disabled-date="disabledDate"
          @change="onChange"
          style="width: 200px"
          size="large"
          placeholder="请选择确诊日期！"
          v-model="complication.extremityDate"
        />
      </a-form-model-item>
      <a-form-model-item label="症状">
        <a-form>
          <a-form-item>
            <j-multi-select-tag
              v-model="complication.extremitySymptom"
              dictCode="pubDossierExtremitySymptom"
              type="checkbox"
            >
            </j-multi-select-tag>
          </a-form-item>
        </a-form>
      </a-form-model-item>

      <a-form-model-item label="颈动脉听诊">
        <a-select style="width: 170px" v-model="complication.extremityCarotid">
          <a-select-option :value="1"> 有杂音 </a-select-option>
          <a-select-option :value="2"> 无杂音 </a-select-option>
        </a-select>
      </a-form-model-item>

      <a-form-model-item label="股动脉听诊">
        <a-select style="width: 170px" v-model="complication.extremityFemoral">
          <a-select-option :value="1"> 有杂音 </a-select-option>
          <a-select-option :value="2"> 无杂音 </a-select-option>
        </a-select>
      </a-form-model-item>

      <a-form-model-item label="间歇性跛行试验">
        <a-select style="width: 170px" v-model="complication.extremityClaudication">
          <a-select-option :value="1"> 阳性 </a-select-option>
          <a-select-option :value="2"> 阴性 </a-select-option>
        </a-select>
      </a-form-model-item>

      <a-form-model-item label="皮肤温度测定">
        <a-select style="width: 170px" v-model="complication.extremitySkin">
          <a-select-option :value="1"> 正常 </a-select-option>
          <a-select-option :value="2"> 异常 </a-select-option>
        </a-select>
      </a-form-model-item>

      <a-form-model-item label="ABI">
        <a-select style="width: 170px" v-model="complication.extremityAbi">
          <a-select-option :value="1"> &lt;0.9 </a-select-option>
          <a-select-option :value="2"> 0.9&lt;=ABI&lt;=1.3 </a-select-option>
          <a-select-option :value="3"> &gt;1.3</a-select-option>
        </a-select>
      </a-form-model-item>

      <a-form-model-item label="ABI运动负载试验">
        <a-select style="width: 170px" v-model="complication.extremityAbiexercise">
          <a-select-option :value="1"> 0.9&lt;=ABI&lt;=1.3 </a-select-option>
          <a-select-option :value="2"> 下降15%～20% </a-select-option>
        </a-select>
      </a-form-model-item>

      <a-form-model-item label="足背/胫后动脉检查">
        <a-select style="width: 170px" v-model="complication.extremityDorsalandposterior">
          <a-select-option :value="1"> 正常 </a-select-option>
          <a-select-option :value="2"> 异常 </a-select-option>
        </a-select>
      </a-form-model-item>

      <a-form-model-item label="下肢血管CTA/DSA/MR/B超">
        <a-select style="width: 170px" v-model="complication.extremityVessel">
          <a-select-option :value="1"> 正常 </a-select-option>
          <a-select-option :value="2"> 提示血管病变 </a-select-option>
          <a-select-option :value="3"> 其它 </a-select-option>
        </a-select>
      </a-form-model-item>
    </div>
    <a-form-model-item :wrapper-col="{ span: 12, offset: 10 }">
      <a-button type="primary" @click="save" :loading="saveLoading">保存</a-button>
      <a-popconfirm placement="topLeft" ok-text="是" cancel-text="否" @confirm="confirm">
        <template slot="title">
          <p>此操作代表你已完成了页面的填写，是否继续？</p>
        </template>
        <a-button type="primary" style="margin-left: 30px" :loading="saveLoading">确认完成</a-button>
      </a-popconfirm>
    </a-form-model-item>
  </a-form-model>
</template>

<script>
import moment from 'moment'

export default {
  name: 'LowerExtremityVascularDisease',
  props: ['complication'],
  data() {
    return {
      confirmType: 8,
      formItemLayout: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 }
        }
      },
      saveLoading: false
    }
  },
  methods: {
    onChange(date, dateString) {
      console.log(date, dateString)
      this.complication.extremityDate = dateString + ' 00:00:00'
      console.log(this.complication.extremityDate)
    },
    disabledDate(current) {
      // Can not select days before today and today
      return current > moment().endOf('day')
    },
    save() {
      this.saveLoading = true
      this.$emit('save', this.confirmType)
    },
    confirm() {
      this.saveLoading = true
      this.$emit('confirm', this.confirmType)
    }
  }
}
</script>

<style lang="less" scoped></style>
